﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2._3._3
{
    class Program
    {
        static void Main(string[] args)
        {
            var list = new List<Student>
            {
                new Student{ID=1,name="张珊",choice=false,chinese=127,maths=145,english=122,summary=289 },
                new Student{ID=2,name="刘亮",choice=true,chinese=103,maths=145,english=122,summary=250 },
                new Student{ID=3,name="薛贵",choice=true,chinese=136,maths=102,english=89,summary=189 },
                new Student{ID=4,name="吴迪",choice=true,chinese=126,maths=98,english=140,summary=238 }
            };
            Console.WriteLine("所有人的信息：");
            foreach(var item in list)
            {
                Console.WriteLine($"编号：{item.ID},姓名：{item.name},是否文科：{item.choice},语文：{item.choice}," +
                    $"数学：{item.maths},英语：{item.english},综合：{item.summary}");
            }
            Console.WriteLine();
            Console.WriteLine("所有文科生成绩");
            var score = list.Where(i => i.choice == true);
            foreach(var item in score)
            {
                Console.WriteLine($"编号：{item.ID},姓名：{item.name},是否文科：{item.choice},语文：{item.choice}," +
                    $"数学：{item.maths},英语：{item.english},综合：{item.summary}");
            }
            Console.WriteLine();
            var avg = list.Where(i => i.choice == true).Average(j => j.summary);
            Console.WriteLine("文科平均成绩："+avg);
        }
    }
}
